import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: HomeView,
      redirect: '/map'
    },
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue')
    },
    {
      path: '/map',
      name: 'map',
      component: () => import('@/views/map/index.vue'),
      redirect: '/map/echarts',
      children: [
        {
          path: '/map/echarts', // echarts地图
          name: 'echarts',
          meta: {title: '', index: '4', hideMenu: true, icon: 'md-locate'},
          component: () => import('@/views/map/echarts/index.vue')
        },
        {
          path: '/map/TXMap', // 腾讯地图
          name: 'TXMap',
          meta: {title: '', index: '4', hideMenu: true, icon: 'md-locate'},
          component: () => import('@/views/map/TXMap/index.vue')
        },
        {
          path: '/map/TianDiTuMap', // 天地图
          name: 'TianDiTuMap',
          meta: {title: '', index: '4', hideMenu: true, icon: 'md-locate'},
          component: () => import('@/views/map/TianDiTuMap/index.vue')
        }
      ]
    },
  ]
})

export default router
